(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
mixpanel.init("9be0c59e374f3b8a9b4c52a87b4e21c6");

import './libs/dataset.js'
import React from 'react'
import { IndexRedirect, Router, IndexRoute, Route, hashHistory, browserHistory, Redirect } from 'react-router'
import { Provider } from 'react-redux'
import { render } from 'react-dom'
import configure from './store'
import App from './containers/app'
import Invalid from './containers/invalid'
import HomeNew from './containers/homenew'
import Home, { NewsFeed, Notifications } from './containers/home'
import util from './util';
import NotFound from './containers/notfound'
import FeedDetail from './containers/home/FeedDetail'
import Survey from './containers/survey/Survey';
import SurveyResponse from './containers/survey/SurveyResponse';

import Personal, {
  Account,
  Remind,
  Basic
} from './containers/personal'

import Team, { 
  MyTeam,
} from './containers/team'

import System, {
  ComponySettings,
  CompanyDocuments,
} from './containers/system'

import User, {
  UserIndex,
  UserReview,
  UserKudos,
  UserConver,
  //UserProfile,
  UserResume,
  UserDocuments,
} from './containers/user'

import {
  Objective,
  ObjectiveDetail,
  ObjectiveAll,
  ObjectiveRelativeTreeView,
  ObjectiveRelativeBirdView,
  ObjectiveTargetAll,
  ObjectiveTargetAudit,
  ProjectTeamAdmin,
} from './containers/okr'

import Review, {
  ReviewSelf,
  ReviewSelfDetail,
  ReviewPeer,
  ReviewAdmin,
  ReviewAdminAdd,
  ReviewReport,
  ReviewIndex,
  ReviewAdminReport,
  ReviewAdminReportDetail,
} from './containers/review'

import Hr, {
  HrIndex,
  HrOnboarding,
  HrOnboardingFlows,
  HrOnboardingTemplate,
  HrOnboardingDocument,
  HrOnboardingCreate,
  HrOnboardingTemplateEdit,
  HrOnboardingInviting,
  HrReorg,
  HrEmployManagement,
  HrTransfer,
  HrTeam,
  HrRelationManage,
  HrTeamManage,
  HrTeamMemeberEdit,
  HrOnboardingBoard,
  HrReorgBoard,
  HrTeamBoard,
  HrSettings,
  HrProfileSetting,
  HrProfileUpload,
  HrProfileImport,
  HrSettingBoard,
  HrTransferCreate,
  HrEmployManagementCreate,
  HrTransferDefail,
  HrEmployManagementDetail,
} from './containers/hr';

import {
  Conversation,
  InitiateConversation,
  ConversationInfo,
  ConversationItem,
  ConversationRecords,
} from './containers/conversation';

const store = window.store = configure()
render(
  <Provider store={store}>
    <Router history={hashHistory}>
      <Route path="/" component={App}>
        <IndexRedirect to="/home" />
        <Route path="company-documents" component={CompanyDocuments} />
        <Route path="home" component={HomeNew} mpModule={'首页::首页'} onEnter={util.track} />
        <Route component={Home}>
          <Route path="newsfeed" component={NewsFeed} mpModule={'动态::动态'} onEnter={util.track}/>
          <Route path="notifications" component={Notifications} mpModule={'消息::消息'} onEnter={util.track}/>
          <Route path="newsfeed/:feedId" component={FeedDetail}/>
        </Route>
        <Route path="team" component={Team}>
          <Route path="myTeam" component={MyTeam} mpModule={'团队::团队'} onEnter={util.track} />
        </Route>
        <Route path="system" component={System}>
          <Route path="companySettings" component={ComponySettings}/>
        </Route>
        <Route path="user" component={User}>
          <Route path=":userId" component={UserIndex} mpModule={'个人主页::个人主页'} onEnter={util.track}/>
          <Route path=":userId/review" component={UserReview}/>
          <Route path=":userId/kudos" component={UserKudos}/>
          <Route path=":userId/conver" component={UserConver}/>
          <Route path=":userId/resume" component={UserResume}/>
          <Route path=":userId/documents" component={UserDocuments}/>
        </Route>
        <Route path="okr" component={Objective}/>
        <Route path="okr/:periodId/objectives" component={Objective}/>
        <Route path="okr/objectives/:objectiveId" component={ObjectiveDetail} mpModule={'目标::目标详情页'} onEnter={util.track} />
        <Route path="okr/objectiveExt/:objectiveId" component={ObjectiveTargetAudit} mpModule={'目标::目标详情审核页'} onEnter={util.track} />
        <Route path="objectives/:objectiveId/relative-tree" component={ObjectiveRelativeTreeView} mpModule={'目标::目标卡片视图'} onEnter={util.track} />
        <Route path="objectives/:objectiveId/bird-view" component={ObjectiveRelativeBirdView} mpModule={'目标::目标鸟瞰图'} onEnter={util.track} />
        <Route path="okr/objective-all" component={ObjectiveAll} mpModule={'目标::目标筛选页'}/>
        <Route path="okr/objective-targetAll" component={ObjectiveTargetAll} mpModule={'目标::人员目标页'}/>
        <Route path="project/team/:teamId" component={ProjectTeamAdmin}/>

        <Route path="hr" component={Hr} >
          <Route path="index" component={HrIndex} mpModule={'人事::人事首页（员工花名册）'} onEnter={util.track}/>
          <Route path="onboarding/board" component={HrOnboardingBoard} />
          <Route path="reorg/board" component={HrReorgBoard} />
          <Route path="team/board" component={HrTeamBoard} />
          <Route path="team-memeber-edit/:userId" component={HrTeamMemeberEdit} />
          <Route path="settings/board" component={HrSettingBoard} />
          <Route path="settings" component={HrSettings}>
            <Route path="profile-settings" component={HrProfileSetting} mpModule={'设置::花名册字段设置'} onEnter={util.track}/>
            <Route path="profile-upload" component={HrProfileUpload} mpModule={'设置::批量邀请'} onEnter={util.track} />
            <Route path="profile-import" component={HrProfileImport} mpModule={'设置::补充花名册数据'} onEnter={util.track}/>
            <Route path="onboarding-inviting" component={HrOnboardingInviting} mpModule={'设置::批量邀请列表'} onEnter={util.track}/>
          </Route>
          <Route path="team" component={HrTeam} mpModule={'人事::组织调整'} onEnter={util.track}>
            <Route path="team-manage" component={HrTeamManage} />
            <Route path="relation-manage" component={HrRelationManage} />
          </Route>
          <Route path="reorg" component={HrReorg} mpModule={'人事::人事调整'} onEnter={util.track}>
            <Route path="employ-managements/:statusType" component={HrEmployManagement}/>
            <Route path="employ-managements-detail/:statusType/:statusUpdateId" component={HrEmployManagementDetail}/>
            <Route path="employ-managements/:statusType/:userId" component={HrEmployManagementCreate}/>
            <Route path="transfer" component={HrTransfer}/>
            <Route path="transfer/:userId" component={HrTransferCreate}/>
            <Route path="transfer-detail/:transferId" component={HrTransferDefail}/>
          </Route>
          <Route path="onboarding" component={HrOnboarding} mpModule={'人事::入职管理'} onEnter={util.track}>
            <Route path="onboarding-flows" component={HrOnboardingFlows}/>
            <Route path="onboarding-template" component={HrOnboardingTemplate}/>
            <Route path="onboarding-template-edit/:onboardingTemplateId" component={HrOnboardingTemplateEdit}/>
            <Route path="onboarding-document" component={HrOnboardingDocument}/>
            <Route path="onboarding-create" component={HrOnboardingCreate}/>
          </Route>
        </Route>
        <Redirect from="review/item/:itemId/activities" to="review/self/:itemId/create" />
        <Redirect from="review/item/:itemId/invitations" to="review/peer/:itemId/fill" />
        <Redirect from="team/staffProfile/:userId" to="hr/team-memeber-edit/:userId" />
        <Redirect from="okr/:periodId/objective" to={"okr/:periodId/objectives"}/>
        <Route path="review" component={Review}>
          <IndexRedirect to="index/default" />
          <Route path="index/:itemId" component={ReviewIndex} mpModule={'反馈::反馈列表'} onEnter={util.track} />
          <Route path="self">
            <Route path=":itemId/create" component={ReviewSelf} mpModule={'反馈::自评内页'} onEnter={util.track}/>
            <Route path=":itemId/detail" component={ReviewSelfDetail} mpModule={'反馈::自评内页'} onEnter={util.track}/>
          </Route>
          <Route path="peer">
            <Route path=":itemId/fill" component={ReviewPeer} mpModule={'反馈::同事反馈（含主管）'} onEnter={util.track}/>
          </Route>
          <Route path="report/:itemId" component={ReviewReport} />
          <Route path="admin" component={ReviewAdmin} mpModule={'反馈::反馈活动管理列表'} onEnter={util.track}/>
          <Route path="admin/add" component={ReviewAdminAdd} mpModule={'反馈::反馈活动创建页'} onEnter={util.track}/>
          <Route path="admin/:templateId/report" component={ReviewAdminReport} mpModule={'反馈::反馈报告'} onEnter={util.track}/>
          <Route path="admin/:itemId/detail" component={ReviewAdminReportDetail}/>
        </Route>
        <Route path="survey" component={Survey}/>
        <Route path="survey/activity" component={SurveyResponse}/>
        <Route path="personal" component={Personal}>
          <Route path="basic" component={Basic} mpModule={'设置::个人设置'} onEnter={util.track}/>
          <Route path="remind" component={Remind}/>
          <Route path="account" component={Account}/>
        </Route>
        <Route path="conversation" component={Conversation}>
          <Route path="initiate" component={InitiateConversation} mpModule={'交谈::发起交谈列表'} onEnter={util.track}/>
          <Route path="record" component={ConversationInfo} mpModule={'交谈::交谈记录列表'} onEnter={util.track}/>
        </Route>
        <Route path="conversation/:itemId" component={ConversationItem} mpModule={'交谈::添加记录交谈'} onEnter={util.track}/>
        <Route path="conversation/:itemId/records" component={ConversationRecords} mpModule={'交谈::记录交谈'} onEnter={util.track}/>
        
        <Route path="notfound" component={NotFound}/>
        <Route path="invalid" component={Invalid}/>
        <Route path="*" component={NotFound}/>
      </Route>
    </Router>
  </Provider>,
  document.getElementById('root')
)
